package com.qingyun.schedule.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalTime;

/**
 * 课表数据传输对象
 */
@Data
public class ScheduleDTO {
    
    private Long id;
    private Long teacherId;
    private Long courseId;
    private LocalDate teachDate;
    private LocalTime startTime;
    private LocalTime endTime;
    private String place;
    private String note;
    private String studentName;
    
    // 前端需要的字段
    private String courseName;  // 课程名称

    // 兼容前端旧字段
    @JsonIgnore
    public String getCourse() {
        return courseName;
    }

    @JsonIgnore
    public String getDate() {
        return teachDate != null ? teachDate.toString() : null;
    }

    @JsonIgnore
    public String getTime() {
        if (startTime != null && endTime != null) {
            return startTime.toString() + "-" + endTime.toString();
        }
        return null;
    }


}
